import React from 'react';
import { ts2Formatter } from 'utils';

{/*
可配置化种类：

1、表格头部字段 
    1、列表页表格头部字段集合 mainTableColumn
    2、编辑页表格头部字段集合 childTableColumn

2、编辑框的字段
    1、编辑页 直接显示在页面的编辑字段 FormField
    2、编辑页 需要点击表格的增行弹框编辑的字段 FormTableField
    3. 列表页查询区域  searchField

3.表头部的按钮  headerButtonSets

4.表行尾部按钮  columnButtonSets
*/}


//渲染成字表表格的头
export const mainTableColumn = [
    {
        title: "一级考核单位",
        dataIndex: "first_check_organName",
        key: "first_check_organName",
    },
    {
        title: "二级考核单位",
        dataIndex: "second_check_organName",
        width: 150,
        key: "second_check_organName",
    },
    {
        title: "三级考核单位",
        dataIndex: "third_check_organName",
        width: 150,
        key: "third_check_organName",
    },
    {
        title: "部门",
        dataIndex: "deptName",
        width: 150,
        key: "deptName",
    },
    {
        title: "公司",
        dataIndex: "orgName",
        width: 150,
        key: "orgName",
    },
    {
        title: "所属公司",
        dataIndex: "companyName",
        width: 120,
        key: "companyName",
    }, {
        title: "采购订单号",
        dataIndex: "vbillcode",
        width: 120,
        key: "vbillcode",
    }, {
        title: "订单执行情况",
        dataIndex: "executestatus",
        width: 120,
        key: "executestatus",
    }, {
        title: "供应商名称",
        dataIndex: "supplierName",
        width: 120,
        key: "supplierName",
    }, {
        title: "供应商类型",
        dataIndex: "pk_supplierclassName",
        width: 120,
        key: "pk_supplierclassName",
    }, {
        title: "供应商评级",
        dataIndex: "deptrating",
        width: 120,
        key: "deptrating",
    }, {
        title: "注册资本（万元）",
        dataIndex: "capital",
        width: 120,
        key: "capital",
    }, {
        title: "预付款定额（万元）",
        dataIndex: "fixquota",
        width: 120,
        key: "fixquota",
    }, {
        title: "业务员",
        dataIndex: "psnName",
        width: 120,
        key: "psnName",
    }, {
        title: "订单日期",
        dataIndex: "billdate",
        width: 120,
        key: "billdate",
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        }
    }, {
        title: "约定到货日期",
        dataIndex: "arrivaldate",
        width: 120,
        key: "arrivaldate",
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        }
    }, {
        title: "付款方式",
        dataIndex: "paymenttypeName",
        width: 120,
        key: "paymenttypeName",
    }, {
        title: "提货方式",
        dataIndex: "deli_method",
        width: 120,
        key: "deli_method",
    }, {
        title: "结算方式",
        dataIndex: "balatypeName",
        width: 120,
        key: "balatypeName",
    }, {
        title: "合同总数量",
        dataIndex: "totalnum",
        width: 120,
        key: "totalnum",
        sumCol:true
    }, {
        title: "总发货数量",
        dataIndex: "arrinum",
        width: 120,
        key: "arrinum",
        sumCol:true
    }, {
        title: "总未发货量",
        dataIndex: "unarrinum",
        width: 120,
        key: "unarrinum",
        sumCol:true
    }, {
        title: "总流向数量",
        dataIndex: "sumflownum",
        width: 120,
        key: "sumflownum",
        sumCol:true
    }, {
        title: "总入库数量",
        dataIndex: "stocknum",
        width: 120,
        key: "stocknum",
        sumCol:true
    }, {
        title: "物流在途数量",
        dataIndex: "roadnum",
        width: 120,
        key: "roadnum",
        sumCol:true
    }, {
        title: "合同不执行总数",
        dataIndex: "noexecutenum",
        width: 120,
        key: "noexecutenum",
        sumCol:true
    }, {
        title: "合同总金额",
        dataIndex: "total_money",
        width: 120,
        key: "total_money",
        sumCol:true
    }, {
        title: "商品大类",
        dataIndex: "materialtypename",
        width: 120,
        key: "materialtypename",
    }, {
        title: "牌号",
        dataIndex: "pk_materialName",
        width: 120,
        key: "pk_materialName",
    }, {
        title: "数量",
        dataIndex: "goodsnum",
        width: 120,
        key: "goodsnum",
        sumCol:true
    }, {
        title: "累积发货数量",
        dataIndex: "goodsarrinum",
        width: 120,
        key: "goodsarrinum",
        sumCol:true
    }, {
        title: "累积流向数量",
        dataIndex: "sumflownumt",
        width: 120,
        key: "sumflownumt",
        sumCol:true
    }, {
        title: "累积入库数量",
        dataIndex: "goodsstocknum",
        width: 120,
        key: "goodsstocknum",
        sumCol:true
    }, {
        title: "物流在途数量",
        dataIndex: "roadnumt",
        width: 120,
        key: "roadnumt",
        sumCol:true
    }, {
        title: "不执行数",
        dataIndex: "goodsnonum",
        width: 120,
        key: "goodsnonum",
        sumCol:true
    }, {
        title: "含税单价",
        dataIndex: "goodstaxprice",
        width: 120,
        key: "goodstaxprice",
    }, {
        title: "金额",
        dataIndex: "goodstotnum",
        width: 120,
        key: "goodstotnum",
        sumCol:true
    }, {
        title: "仓库",
        dataIndex: "goodsstockName",
        width: 120,
        key: "goodsstockName",
    }, {
        title: "执行情况",
        dataIndex: "executestatust",
        width: 120,
        key: "executestatust",
    },{
        title: "备注",
        dataIndex: "vmemo",
        width: 150,
        key: "vmemo",
    },
]

export const searchField = [
    {

        enname: "first_check_organ",
        zhname: "一级考核单位",
        required: false,
        type: "RefComponent",
        refname: "departmentTableRef",
        param:{condition: 1,"AUTH_refdim":"fcuid","AUTH_refcod":"9999-99-99"},
        realRef: true,
        edit: true
    },
    {
        enname: "second_check_organ",
        zhname: "二级考核单位",
        required: false,
        type: "RefComponent",
        refname: "departmentTableRef",
        param:{condition: 2,AUTH_refcod:"9908-01-03"},
        realRef: true,
        edit: true
    },
    {
        enname: "dept",
        zhname: "部门",
        // required: true,
        type: "RefComponent",
        refname: "departmentTableRef",
        param:{"AUTH_refdim":"deptid","AUTH_refcod":"9999-99-99"},
        // param:{"AUTH_refcod":"9908-01-01"},
        realRef: true,
        edit: true
    },
    {
        enname: "pk_org",
        zhname: "公司",
        type: "RefComponent",
        refname: "organization",
        param:{"AUTH_refdim":"puorgid","AUTH_refcod":"9999-99-99"},
        realRef: true,
        edit: true
    },
    {
        enname: "vbillcode",
        zhname: "采购订单号",
        required: false,
        type: "FormControl",
        edit: true
    },{
        enname: "pk_supplierclass",
        zhname: "供应商类型",
        required: false,
        type: "RefComponent",
        refname: "categorySupplierRef",
        realRef: true,
        edit: true,
    },
    {
        enname: "supplier",
        zhname: "供应商",
        required: false,
        type: "RefComponent",
        refname: "supplierRef",
        realRef: true,
        edit: true,
    },
    {
        enname: "executestatus",
        zhname: "订单执行情况",
        required: false,
        type: "Select",
        options:[{code:"完成",name:"完成"},{code:"未完成",name:"未完成"}],
        edit: true
    },
    {
        enname: "balatype",
        zhname: "结算方式",
        type: "RefComponent",
        refname: "settlementRef",//参照结算方式
        edit: true,
        realRef: true,
        required: false
    },{
        enname: "billdate",
        zhname: "订单日期",
        type: "RangePicker",
        format: "YYYY-MM-DD",
        rangeField: ["billdate", "billdate"],
        edit: true,
    },{
        enname: "psn",
        codename: "vdef3Code",
        showname: "vdef3Name",
        zhname: "业务员",
        type: "RefComponent",
        refname: "personRef",
        realRef:true,
    },{
        enname: "inout",
        zhname: "本级/驻外",
        required: false,
        type: "Select",
        options: [{
            "code": "本级",
            "name": "本级"
        }, {
            "code": "驻外",
            "name": "驻外"
        }],
        edit: true
    }
]

export const SelectCode = ["MRJT_TRADETYPE"]
